﻿using SYMetro.Domain.Modal.Membership;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SYMetro.Repository.EntityFramework.ModelConfigurations.Membership
{
    class UserTypeConfiguration : EntityTypeConfiguration<User>
    {
        public UserTypeConfiguration()
        {
            HasKey<Guid>(l => l.ID);
            Property(p => p.ID)
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
            Property(p=>p.LastActivityDate).IsOptional();
            Property(p=>p.LastLockoutDate).IsOptional();
            Property(p=>p.LastLoginDate).IsOptional();
            Property(p=>p.LastPasswordChangedDate).IsOptional();
            HasMany(l => l.InRoles).WithMany(r => r.Users).Map(m => m.ToTable("UserInRoles"));
        }
    }
}
